package chapter09plus

/**
  *
  * @author Pop
  * @date 2022/7/5 22:39
  */
object Test01_Exception {

  def main(args: Array[String]): Unit = {

    try {
      val n = 10/0
    }catch {

      case e:ArithmeticException =>{
         println("异常")
      }

      case e:Exception =>{
        println("异常1")
      }

    }finally {
      println("处理结束")
    }

    // 声明一个异常，和java的throws 声明是一致的
    @throws(classOf[NumberFormatException])
    def  test():Nothing ={
      throw new Exception("不对")
    }

  }

}
